package com.zhuannimei.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;

import com.zhuannimei.R;
import com.zhuannimei.service.AsyncDataLoader;
import com.zhuannimei.service.AsyncDataLoader.Callback;
import com.zhuannimei.utility.ZnmData;

public class LaunchActivity extends BaseActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_main_pre);
		new AsyncDataLoader(new Callback() {
			
			@Override
			public void onStart() {
					SystemClock.sleep(2000);
			}
			
			@Override
			public void onPrepare() {
				
			}
			
			@Override
			public void onFinish() {
				String userUserId =ZnmData.getUserData().getUserUserId();
				if (TextUtils.isEmpty(userUserId)) {// 需要注册
					Intent intent = new Intent(LaunchActivity.this,  UserLoginActivity.class);
					startActivity(intent);
					LaunchActivity.this.finish();
				} else {// 直接到主界面
					Intent intent = new Intent(LaunchActivity.this,  ConversionActivity.class);
					startActivity(intent);
					LaunchActivity.this.finish();
				}
			}
		}).execute();
	
	}
	//登录
	public void login(View v){
		Intent intent = new Intent(this,  UserLoginActivity.class);
		startActivity(intent);
	}
	//注册
	public void reg(View v){
		Intent intent = new Intent(this,  UserRegActivity.class);
		startActivity(intent);
	}

}
